#ifndef EVENT_REPORT_HEADER
#define EVENT_REPORT_HEADER

#include <cstdint>
#include <string>
#include "EventReportParam.h"

namespace huawei {
namespace er {

#ifdef CONTROL_WINDOWS
#define ERAPI __declspec(dllexport)
#else
#define ERAPI __attribute__ ((__visibility__ ("default")))
#endif

class IHEventReporter {
public:
    virtual ~IHEventReporter() = default;
    
    /* 
     * @brief 添加一个打点事件
     *        如果通道没有初始化，则放到缓存中
     * 
     * @param eventType 事件eventid 
     * @param data 事件内容json格式，中文需转成utf-8格式
     * 
     * @return true 成功，false 失败
     */
    virtual bool addEvent(uint32_t eventId, const std::string &data) = 0;

    /* 
     * @brief 添加一个打点事件立刻上报
     * 
     * @param eventType 事件eventid 
     * @param data 事件内容json格式，中文需转成utf-8格式
     * 
     * @return true 成功，false 失败
     */
    virtual bool addEventAndReport(uint32_t eventId, const std::string &data) = 0;

    /* 
     * @brief 主动触发上传
     * 
     * @return true 成功，false 失败
     */
    virtual bool upload() = 0;

    // add for packet mode
    virtual int32_t addVideoStreamUpEvent(struct RTSA_V_EVENT *event) = 0;
    virtual int32_t addVideoStreamDownEvent(struct RTSA_V_EVENT *event) = 0;
    virtual int32_t addAudioStreamUpEvent(struct RTSA_A_EVENT *event) = 0;
    virtual int32_t addAudioStreamDownEvent(struct RTSA_A_EVENT *event) = 0;
};

ERAPI IHEventReporter *createEventReporter(std::uintptr_t engine);
ERAPI IHEventReporter *getEventRepoter(std::uintptr_t engine);


} // namespace er
} // namespace huawei
#endif